Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fleet] Fix policy revision number getting bumped for no reason #104696

Merged
merged 2 commits into from
Jul 7, 2021

Conversation

Zacqary
Copy link
Contributor

@Zacqary Zacqary commented Jul 7, 2021

Summary

Fixes #104584

The check to see if any top-level fields on is_managed policies had changed was broken, and wasn't correctly filtering the current agent policy down to only the diff-checked fields. This fixes the issue.

@Zacqary Zacqary added v8.0.0 Feature:Fleet Fleet team's agent central management project Team:Fleet Team label for Observability Data Collection Fleet team v7.14.0 auto-backport Deprecated - use backport:version if exact versions are needed v7.15.0 labels Jul 7, 2021
@Zacqary Zacqary requested a review from a team as a code owner July 7, 2021 16:45
@Zacqary Zacqary self-assigned this Jul 7, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Feature:Fleet)

@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@Zacqary Zacqary added the release_note:skip Skip the PR/issue when compiling release notes label Jul 7, 2021
Comment on lines 145 to 148
const configTopLevelFields = omit(preconfiguredAgentPolicy, 'package_policies', 'id');
const currentTopLevelFields = omit(policy, 'package_policies');
const currentTopLevelFields = pick(policy, ...Object.keys(configTopLevelFields));

if (!isEqual(configTopLevelFields, currentTopLevelFields)) {
Copy link
Member

@nchaulet nchaulet Jul 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it will make sense to have a non regression test here? and maybe extract this to a hasPreconfiguredPolicyChanged() or better naming to make writing this test easier?

Copy link
Member

@nchaulet nchaulet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding the test 🚀

@Zacqary Zacqary enabled auto-merge (squash) July 7, 2021 19:28
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @Zacqary

@Zacqary Zacqary merged commit b911369 into elastic:master Jul 7, 2021
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jul 7, 2021
…tic#104696)

* [Fleet] Fix policy revision number getting bumped for no reason

* Add test for comparing preconfig policy to current
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jul 7, 2021
…tic#104696)

* [Fleet] Fix policy revision number getting bumped for no reason

* Add test for comparing preconfig policy to current
@kibanamachine
Copy link
Contributor

💚 Backport successful

Status Branch Result
7.14
7.x

The backport PRs will be merged automatically after passing CI.

@Zacqary Zacqary deleted the 104584-revision-bump-fix branch July 7, 2021 21:39
kibanamachine added a commit that referenced this pull request Jul 7, 2021
) (#104767)

* [Fleet] Fix policy revision number getting bumped for no reason

* Add test for comparing preconfig policy to current

Co-authored-by: Zacqary Adam Xeper <Zacqary@users.noreply.github.com>
jloleysens added a commit to jloleysens/kibana that referenced this pull request Jul 8, 2021
…-of-max-results

* 'master' of github.com:elastic/kibana: (36 commits)
  Lower Kibana app bundle limits (elastic#104688)
  [Security Solutions] Fixes bug with the filter query compatibility for transforms (elastic#104559)
  [RAC] Add mapping update logic to RuleDataClient (elastic#102586)
  Fix import workpad (elastic#104722)
  [canvas] Fix Storybook service decorator (elastic#104750)
  [Detection Rules] Add 7.14 rules (elastic#104772)
  [Enterprise Search] Fix beta notification in sidebar (elastic#104763)
  Fix engine routes that are meta engine or non-meta-engine specific (elastic#104757)
  [Fleet] Fix policy revision number getting bumped for no reason (elastic#104696)
  persistable state migrations (elastic#103680)
  [Fleet] Fix add agent in the package policy table (elastic#104749)
  [DOCS] Creates separate doc for security in production (elastic#103973)
  [SO Migration] fix reindex race on multi-instance mode (elastic#104516)
  [Security Solution] Update text in Endpoint Admin pages (elastic#104649)
  [package testing] Decrease timeout to 2 hours (elastic#104668)
  Fix background styling of waterfall chart sidebar tooltip. (elastic#103997)
  [Fleet + Integrations UI] Integrations UI Cleanup (elastic#104641)
  [Fleet] Link to download page of current stack version on Agent install instructions (elastic#104494)
  [Workplace Search] Fix Media Type field preview is unformatted bug (elastic#104684)
  [ML] add marker body (elastic#104672)
  ...

# Conflicts:
#	x-pack/plugins/fleet/public/search_provider.test.ts
@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Jul 9, 2021
@kibanamachine
Copy link
Contributor

Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync.

1 similar comment
@kibanamachine
Copy link
Contributor

Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync.

@kibanamachine kibanamachine removed the backport missing Added to PRs automatically when the are determined to be missing a backport. label Jul 13, 2021
kibanamachine added a commit that referenced this pull request Jul 13, 2021
) (#104768)

* [Fleet] Fix policy revision number getting bumped for no reason

* Add test for comparing preconfig policy to current

Co-authored-by: Zacqary Adam Xeper <Zacqary@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed Feature:Fleet Fleet team's agent central management project release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team v7.14.0 v7.15.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Fleet]: Revision number for Elastic Agent on Cloud policy increases unknowingly.
4 participants